import {createRouter, createWebHashHistory} from 'vue-router'

// 1. 定义路由组件， 注意，这里一定要使用 文件的全名（包含文件后缀名）
import Home from "../pages/Home.vue";
import Info from "../pages/Info.vue";
import Price from "../pages/Price.vue";
import Contact from "../pages/Contact.vue";

// 2. 定义路由配置
const routes = [
    {path:'/home', name: 'home', component: Home},
    {path:'/info', name: 'info', component: Info},
    // {path:'/info/:id', name: 'info', component: Info},//路由传参方式2
    {path:'/price', name: 'price', component: Price},
    {path:'/contact', name: 'contact', component: Contact},
    {path: '/', redirect: '/home'}
]

// 3. 创建路由实例
const router = createRouter({
    history: createWebHashHistory(),
    routes
});

export default router